<?php
/**
 * TomatoCMS
 *
 * LICENSE
 *
 * This source file is subject to the GNU GENERAL PUBLIC LICENSE Version 2
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.gnu.org/licenses/gpl-2.0.txt
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@tomatocms.com so we can send you a copy immediately.
 *
 * @copyright    Copyright (c) 2009-2010 TIG Corporation (http://www.tig.vn)
 * @license        http://www.gnu.org/licenses/gpl-2.0.txt GNU GENERAL PUBLIC LICENSE Version 2
 * @version     $Id: add.phtml 3032 2010-05-25 08:00:42Z huuphuoc $
 */
?>
<?php
$this->headTitle($this->translator('order_edit_duplicate_page_title'));
$this->headScript()->appendFile($this->APP_STATIC_SERVER.'/js/jquery.validate/jquery.validate.min.js');
?>

<div class="grid_12 t_a_breadcump">
    <span><a href="<?php echo $this->url(array(), 'core_index_dashboard'); ?>"><?php echo $this->translator('menu_admin', 'core'); ?></a></span>
    <span><a href="<?php echo $this->url(array(), 'order_order_list'); ?>"><?php echo $this->translator('order_list_breadcump'); ?></a></span>
    <span><a href="<?php echo $this->url(array('order_id' => $this->order->order_id), 'order_order_view'); ?>"><?php echo $this->translator('order_view_breadcump'); ?></a></span>
    <span><?php echo $this->translator('order_edit_duplicate_breadcump'); ?></span>
</div>

<div class="grid_12"><?php echo $this->flashMessenger(); ?></div>

<form method="post" action="<?php //echo $this->url(array(), 'order_order_add'); ?>" id="addorderForm" class="t_a_form">
<div class="grid_12 t_a_bottom"><?php //echo $this->translator('order_add_guide'); ?></div>
<div class="grid_12 t_a_bottom">
        <input type="button" value="<?php echo $this->translator('order_edit_btn_back');?>" onclick="window.location.href = '<?php echo $this->url(array('order_id' => $this->order->order_id), 'order_order_view'); ?>'"/>
    </div>
<?php $order = $this->order?>
<div class="grid_12 t_a_bottom">
    <div class="clearfix t_a_bottom">
        <div class="grid_2 alpha"><label><?php echo $this->translator('order_id'); ?>:</label></div>
        <div class="grid_10 omega">
            <div style="width: 200px;float:left"><?php echo $order->order_invoice;?></div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <label><?php echo $this->translator('order_status'); ?>:</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <?php if($order->order_status == 'canceled'):?>
            <font color="Red"><?php echo $this->translator('order_'.$order->order_status);?></font>
            <?php else:?>
            <font color="Green"><?php echo $this->translator('order_'.$order->order_status);?></font>
            <?php endif;?>
        </div>
    </div>

    <div class="clearfix t_a_bottom">
        <div class="grid_2 alpha"><label><?php echo $this->translator('order_created_date'); ?>:</label></div>
        <div class="grid_10 omega">
            <div style="width: 200px;float:left"><?php echo $order->order_created_date;?></div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <label><?php echo $this->translator('order_total_amount'); ?>:</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <?php echo $order->order_total_amount;?> <?php echo $order->order_total_amount_currency;?>
        </div>
    </div>

    <?php if ($order->order_edited == 1):?>
    <div class="clearfix t_a_bottom">
        <div class="grid_2 alpha"><label><?php echo $this->translator('order_modify_date'); ?>:</label></div>
        <div class="grid_10 omega">
            <div style="width: 200px;float:left"><?php echo $order->order_modified_date;?></div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <label><?php echo $this->translator('order_modify_amount'); ?>:</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;                    <?php echo $order->order_modify_amount;?> <?php echo $order->order_modify_amount_currency;?>
        </div>
    </div>
    <?php endif;?>
    <div class="clearfix t_a_bottom">
        <div class="grid_2 alpha"><label><?php echo $this->translator('order_customer'); ?>:</label></div>
        <div class="grid_10 omega">
            <div style="width: 200px;float:left">
                <label><?php echo $this->translator('order_customer_id'); ?>:</label>&nbsp;&nbsp;
                <?php echo $order->customer_id;?></div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <label><?php echo $this->translator('order_customer_name'); ?>:</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <a class="t_a_link" href="<?php echo $this->url(array('user_id' => $order->user_id), 'account_customer_view'); ?>"><?php echo $order->full_name;?></a>
        </div>
    </div>	<div class="clearfix t_a_bottom">        <div class="grid_2 alpha"><label><?php echo $this->translator('order_total_shipping_cost'); ?>:</label></div>        <div class="grid_10 omega">            <?php echo $order->order_total_shipping_cost;?> USD        </div>    </div>
    <div class="clearfix t_a_bottom">
        <div class="grid_2 alpha"><label><?php echo $this->translator('order_tracking_status'); ?>:</label></div>
        <div class="grid_10 omega">
            <?php echo $this->translator('order_'.$order->order_tracking_status);?>
        </div>
    </div>
</div>
</form>

<div class="grid_12 t_a_bottom">
    <div class="grid_3 alpha t_a_line">
        <h2><?php echo $this->translator('order_product_name'); ?></h2>
    </div>
    <div class="grid_3 t_a_line">
        <h2><?php echo $this->translator('order_values'); ?></h2>
    </div>
    <div class="grid_2 t_a_line">
        <h2><?php echo $this->translator('order_quantity'); ?></h2>
    </div>
    <div class="grid_2 omega t_a_line">
        <h2><?php echo $this->translator('order_amount'); ?></h2>
    </div>
    <div class="grid_2 omega t_a_line">
        <h2><?php echo $this->translator('order_edit_action'); ?></h2>
    </div>
</div>
<div class="grid_12">
    <?php foreach ($this->products as $row):?>
    <form id="orderDetail_<?php echo $row->order_detail_id;?>" action="" method="POST">
    <input type="hidden" value="<?php echo $row->order_detail_id?>" name="order_detail_id">
    <div class="clearfix t_a_box">
        <div class="grid_3 alpha">
            <div style="padding-left: 5px">
                <?php if($row->order_detail_parent_id != null):?>
                    --- <?php echo $row->product_admin_name?>
                <?php else:?>
                    <?php echo $row->product_admin_name?>
                <?php endif;?>
                &nbsp;
            </div>
        </div>

        <div class="grid_3">
            <?php $arrAttributeValue = $this->arrAttributeValue[$row->product_id];?>
            <?php $i = 0; foreach ($this->arrAttribute[$row->product_id] as $row1):?>
                <?php $i++; if(count($this->arrAttribute[$row->product_id]) == $i):?>
                    <?php $str = '';?>
                <?php else :?>
                    <?php $str = '<br>';?>
                <?php endif;?>
                <?php echo $row1->attribute_type_admin_name;?>
                <select name="value_type_id[]">
                    <?php foreach ($arrAttributeValue[$row1->attribute_type_id] as $row2):?>
                        <option value="<?php echo $row2->value_type_id;?>" <?php if(strstr($row->product_value_type_id_chain,','.$row2->value_type_id.',')) echo 'selected';?>>
                            <?php echo $row2->value_type_name;?>
                        </option>
                    <?php endforeach;?>
                </select>
                <?php echo $str;?>
            <?php endforeach;?>
            &nbsp;
        </div>

        <div class="grid_2">
            <?php if($row->order_detail_parent_id != null || $row->product_bundle == 1):?>
            <?php else:?>
                <input type="text" value="<?php echo $row->order_detail_quantity?>" name="order_detail_quantity">
            <?php endif;?>
            &nbsp;
        </div>

        <div class="grid_2 omega">
            <?php if($row->order_detail_parent_id != null):?>
            <?php else:?>
                <?php echo $row->order_detail_quantity*$row->product_price?> <?php echo $row->product_price_currency?>
                <input type="hidden" value="<?php echo $row->product_price?>" name="product_price">
                <input type="hidden" value="<?php echo $row->order_detail_quantity*$row->product_price?> <?php echo $row->product_price_currency?>" name="old_product_amount">				<input type="hidden" value="<?php echo $row->product_shipping_price?>" name="product_shipping_price">				<input type="hidden" value="<?php echo $row->order_detail_quantity*$row->product_shipping_price?>" name="old_product_shipping_price">
            <?php endif;?>
            &nbsp;
        </div>

        <div class="grid_2 omega">
            <?php if($row->product_bundle == 1):?>
            <?php else:?>
            <input type="submit" value="<?php echo $this->translator('order_edit_action_change'); ?>">
            <?php endif;?>
            &nbsp;
        </div>
    </div>
    </form>
    <?php endforeach;?>
</div>

<script type="text/javascript">

$(document).ready(function() {

})
</script>
